package ink.lovejinhu.leetcode;

/**
 * @author jinhu
 * created 2021-07-20 15:12
 */
public class Solution_0496 {
    public int[] nextGreaterElement(int[] nums1, int[] nums2) {
        for (int i = 0; i < nums1.length; i++) {
            for (int j = 0; j < nums2.length; j++) {
                if (nums1[i] == nums2[j]) {
                    int res = -1;
                    for (int k = j + 1; k < nums2.length; k++) {
                        if (nums2[k] > nums2[j]) {
                            res = nums2[k];
                            break;
                        }
                    }
                    nums1[i] = res;
                    break;
                }

            }

        }
        return nums1;
    }
}
